const Utils = require("./Utils.js")

Utils.init()

// 关闭好友协助申请
threads.start(() => {
  while (true) {
    sleep(30 * 1000)
    Utils.findPhotoTap("叉号", 0.8, [1100, 120, 140, 120])
  }
})

let flag = true
const num = 90
let seconds = num
let count = 0
let times = 200

while (flag) {
  sleep(2000)
  if (Utils.findPictureTap("临时挑战")) {
    Utils.waitTime(10)
    if (Utils.findPictureTap("临时挑战")) {
      Utils.stopJB()
    } 
  } else if (Utils.findPictureTap("奖励")) {
  } else if (Utils.findPictureTap("准备")) {
    Utils.waitTime(seconds)
  } else if (Utils.findPictureTap("胜利")) {
    seconds = num
    count++
  } else if (Utils.findPictureTap("叉号")) {
  } else {
    log("已等待: " + (seconds += 7) + " 秒")
  }
  if (times === count) {
    Utils.stopJB()
  }
  log("已挑战: " + count + " 次")
}
